import React, { useMemo } from "react";
import { DataSet, Table } from "choerodon-ui/pro";
import { ColumnProps } from "choerodon-ui/pro/lib/table/Column";
import { TableQueryBarType } from "choerodon-ui/pro/lib/table/enum";

export default function Test() {
  const tableDs = useMemo(() => {
    return new DataSet({
      data: [
        {
          name: "ming",
          age: 12,
          sex: "male",
          height: 1.7,
          weight: 80,
        },
        {
          name: "ming",
          age: 12,
          sex: "male",
          height: 1.7,
          weight: 80,
        },
        {
          name: "ming",
          age: 12,
          sex: "male",
          height: 1.7,
          weight: 80,
        },
        {
          name: "ming",
          age: 12,
          sex: "male",
          height: 1.7,
          weight: 80,
        },
        {
          name: "ming",
          age: 12,
          sex: "male",
          height: 1.7,
          weight: 80,
        },
      ],
      fields: [
        {
          name: "name",
          label: "名称",
        },
        {
          name: "age",
          label: "年龄",
        },
        {
          name: "sex",
          label: "性别",
        },
        {
          name: "height",
          label: "身高",
        },
        {
          name: "weight",
          label: "体重",
        },
      ],
      queryFields: [
        {
          name: "name",
          label: "名称",
        },
      ],
    });
  }, []);

  const columns: ColumnProps[] = [
    {
      name: "name",
      hidden: true,
    },
    {
      name: "age",
    },
    {
      name: "sex",
    },
    {
      name: "height",
    },
    {
      name: "weight",
    },
  ] as ColumnProps[];

  return (
    <>
      <Table
        dataSet={tableDs}
        columns={columns}
        // @ts-ignore
        // queryFields={{ name: <TextField name='name' hidden={isHidden} /> }}
        queryBar={TableQueryBarType.professionalBar}
      ></Table>
    </>
  );
}
